Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#158) Split out list command to its own command class #3072

Merged
merged 5 commits into from
Mar 17, 2023

Conversation

AdmiringWorm
Copy link
Member

Description Of Changes

This pull requests splits out the list command to be its own command in the source codes, which can only handle local packages and not remote sources.
In this move, all arguments that had been deprecated for the list command have been completely removed from the list command, and a few remote only arguments will be warning about that they are unsupported (this won't do anything at all).

The tab completion file has also been updated with this new logic, with an adition that remote searches have had their local arguments removed from the tab completion.

Motivation and Context

To make list searching only local packages, while using search and find will be for remote sources.

Testing

  1. Run choco list
  2. Verify only locally installed packages is shown
  3. Run choco search against a feed not containing 1 or more of the installed pakcages
  4. Verify the packages only available locally is not shown
  5. Run choco list --local-only
  6. Verify a warning is outputted (purple) about the argument being unsupported
  7. Run choco search --local-only --verbose
  8. Verify the console mentions it used a query with the search term --local-only
  9. Run choco info chocolatey --local-only
  10. Verify information is shown about the local package, and no warning about unsupported argument.
  11. Run choco info upgradepackage (against internal repository source)
  12. Verify the remote package information is shown
  13. (Optional) Run test kitchen against the tags ListCommand,SearchCommand and InfoCommand

Operating Systems Testing

  • Windows 11
  • Windows Server 2019

Change Types Made

  • Bug fix (non-breaking change).
  • Feature / Enhancement (non-breaking change).
  • Breaking change (fix or feature that could cause existing functionality to change).
  • Documentation changes.
  • PowerShell code changes.

Change Checklist

  • Requires a change to the documentation.
  • Documentation has been updated.
  • Tests to cover my changes, have been added.
  • All new and existing tests passed?
  • PowerShell code changes: PowerShell v2 compatibility checked?

Related Issue

@AdmiringWorm AdmiringWorm self-assigned this Mar 17, 2023
@AdmiringWorm AdmiringWorm requested review from corbob, gep13 and vexx32 March 17, 2023 16:16
@AdmiringWorm AdmiringWorm marked this pull request as draft March 17, 2023 16:26
@AdmiringWorm AdmiringWorm marked this pull request as ready for review March 17, 2023 16:29
@AdmiringWorm AdmiringWorm marked this pull request as draft March 17, 2023 16:40
@AdmiringWorm AdmiringWorm marked this pull request as ready for review March 17, 2023 17:29
Copy link
Member

@corbob corbob left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few things that jumped out at me. I'm still not complete going through everything, but just about to take a break.

tests/chocolatey-tests/chocolatey.Tests.ps1 Outdated Show resolved Hide resolved
tests/chocolatey-tests/chocolatey.Tests.ps1 Outdated Show resolved Hide resolved
tests/chocolatey-tests/chocolatey.Tests.ps1 Outdated Show resolved Hide resolved
tests/chocolatey-tests/commands/choco-list.Tests.ps1 Outdated Show resolved Hide resolved
tests/chocolatey-tests/commands/choco-list.Tests.ps1 Outdated Show resolved Hide resolved
tests/chocolatey-tests/commands/choco-list.Tests.ps1 Outdated Show resolved Hide resolved
Copy link
Member

@vexx32 vexx32 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple questions here, but overall this looks good. Nice work! 💖

(chocolatey#158) Remove list alias for remote searches

This commit removes the list alias for remote searches
and renames the command class to be ChocolateySearchCommand
to reflect it is for remote searches.

As a side effect, the Info command now inherits from
the search command which should be fine in most
cases.
This commit moves everything related to listing local packages
to its own new class that will only be responsible
for listing local packages.

This also changes the behavior of the search and find commands
to only be able to search on remote feeds.
This commit updates the tab completion by removing the now
unsupported arguments on the list command and
remove local only arguments from the search command.

Additionally, as it was found to be missing, the find command
was also added to the tab completion.
corbob added 2 commits March 17, 2023 16:28
Remove extraneous comments
Space out Tags
Add Tag parameter where missing.
Be explicit with unsupported arguments so we don't accidentally warn on
packages with those names.
@corbob corbob merged commit e5c6e1a into chocolatey:develop Mar 17, 2023
@corbob
Copy link
Member

corbob commented Mar 17, 2023

Thank you for getting this done @AdmiringWorm 👍

@AdmiringWorm AdmiringWorm deleted the list-local-only branch April 4, 2023 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change behavior of choco list to be local only
3 participants